package org.ichow.version
{
	import flash.display.DisplayObjectContainer;
	import flash.ui.ContextMenu;
	import flash.ui.ContextMenuItem;
	import org.ichow.debug.Debug;
	
	/**
	 * ...
	 * 添加右键版本信息
	 * @author M.ichow
	 */
	public class VersionInfo extends Object
	{
		/**
		 * 绑定
		 * @param	s			:	目標
		 * @param	vo			:	版本類
		 * @param	name		:	項目名
		 */
		public static function init( s : DisplayObjectContainer , vo : Object , name : String = "" ) : void
		{
			var _menu : ContextMenu = new ContextMenu();
			var _version : String = vo.Major + "." + vo.Minor + "." + vo.Build + "." + vo.Revision + "  " + vo.Timestamp + " by " + vo.Author;
			var _item : ContextMenuItem = new ContextMenuItem( _version , false , false );
			_menu.hideBuiltInItems();
			_menu.customItems.push( _item );
			if ( !s )
				return;
			s.contextMenu = _menu;
			Debug.log( "\nProject: " + name + " \nBuild: " + _version + "<< " , s , Debug.LEVEL_DEBUG );
		}
	
	}

}